﻿<UserControl x:Class="ContactViewer.Page"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
    Width="400" Height="600">
    <StackPanel x:Name="LayoutRoot" Background="White">
        <Button Height="30" Content="reload" Click="Button_Click" VerticalAlignment="Top" />
        <ListBox ItemsSource="{Binding Path=ResultList}" 
                 SelectionChanged="ListSelectionChanged"
                 Height="408">
            <ListBox.ItemTemplate>
                <DataTemplate>
                    <Grid>

                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="50"/>
                            <ColumnDefinition />
                        </Grid.ColumnDefinitions>

                        <Image Grid.Column="0" Source="{Binding Path=Picture}" Width="50" Height="50"/>

                        <Rectangle Fill="Silver" Margin="2,2,2,2" Grid.Column="1" Width="400" />
                        <StackPanel Grid.Column="1">
                            <TextBlock Margin="6,3,3,0" Text="{Binding Path=FullName}"/>
                            <TextBlock Margin="6,0,3,3" Text="{Binding Path=Street}"/>
                            <TextBlock Margin="6,0,3,3" Text="{Binding Path=City}"/>
                        </StackPanel>

                    </Grid>
                </DataTemplate>
            </ListBox.ItemTemplate>
        </ListBox>
        <StackPanel Orientation="Horizontal" DataContext="{Binding Path=CurrentContact}">
            <Image Height="160" HorizontalAlignment="Left" VerticalAlignment="Bottom" Width="120" Source="{Binding Path=Picture}" />
            <StackPanel Orientation="Vertical">
                <TextBlock Height="14" Margin="10,10,10,10" VerticalAlignment="Bottom" Text="{Binding Path=FullName}"   TextWrapping="Wrap" />
                <TextBlock Height="17" Margin="10,10,10,10" VerticalAlignment="Bottom" Text="{Binding Path=Street}"     TextWrapping="Wrap"/>
                <TextBlock Height="17" Margin="10,10,10,10" VerticalAlignment="Bottom" Text="{Binding Path=City}"       TextWrapping="Wrap"/>
            </StackPanel>
        </StackPanel>
    </StackPanel>
</UserControl>
